package com.jtny.nytb.equipment.service;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jtny.component.entity.PageData;
import com.jtny.component.entity.PageParam;
import com.jtny.nytb.equipment.vo.rule.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

/**
 * @author 智慧能源中心 - 伍天宇
 * @package com.jtny.nytb.equipment.biz
 * @fileName RuleNumberBiz.java
 * @createTime 2023年09月14日 16:38
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
public interface RuleNumberService {
    /**
     * 查询 设备编号级别 分页
     *
     * @param codeLevelQueryVO 代码级查询 VO
     * @return {@link PageData}<{@link CodeLevelPageVO}>
     */
    @PostMapping("/query-page")
    @ApiOperation("分页查询设备编号规则")
    @ApiOperationSupport(order = 1)
    PageData<CodeLevelPageVO> queryCodeLevelPage(String type, CodeLevelQueryVO codeLevelQueryVO);

    /**
     * 列表级别
     *
     * @return {@link List}<{@link LevelNumberInfoVO}>
     */
    @ApiOperation("获取设备编号级别")
    @GetMapping("/getRuleLevel")
    @ApiOperationSupport(order = 12)
    List<LevelNumberInfoVO> listLevel(String type);

    /**
     * 查询 设备编号规则 分页
     *
     * @param levelId   级别标识
     * @param pageParam 页面参数
     * @return {@link PageData}<{@link CodeRulePageVO}>
     */
    @PostMapping("/query-level-page/{levelId}")
    @ApiOperation("分页查询设备编号规则")
    @ApiOperationSupport(order = 2)
    @ApiImplicitParam(name = "levelId", value = "级别id", required = true, dataType = "Long", paramType = "path")
    PageData<CodeRulePageVO> queryCodeRulePage(String type, Long levelId, PageParam pageParam);

    /**
     * 保存设备编号级别
     *
     * @param ruleNumberFormVO 设备编号级别表单VO
     * @return {@link Boolean}
     */
    @PostMapping("/save")
    @ApiOperation("新增设备编号级别")
    @ApiOperationSupport(order = 3)
    Boolean saveCodeLevel(String type, RuleNumberFormVO ruleNumberFormVO);

    /**
     * 更新设备编号级别
     *
     * @param ruleNumberFormVO 设备编号级别 VO
     * @return {@link Boolean}
     */
    @PutMapping("/update")
    @ApiOperation("编辑设备编号级别")
    @ApiOperationSupport(order = 4)
    Boolean updateCodeLevel(String type, RuleNumberFormVO ruleNumberFormVO);

    /**
     * 删除设备编号级别
     *
     * @param id 主键id
     * @return {@link Boolean}
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除设备编号级别")
    @ApiOperationSupport(order = 5)
    @ApiImplicitParam(name = "id", value = "设备编号级别id", required = true, dataType = "Long", paramType = "path")
    Boolean deleteCodeLevel(String type, Long id);

    /**
     * 根据id查询设备编号级别
     *
     * @param id 主键id
     * @return {@link LevelNumberInfoVO}
     */
    @GetMapping("/detail/{id}")
    @ApiOperation("详情设备编号级别")
    @ApiOperationSupport(order = 6)
    @ApiImplicitParam(name = "id", value = "设备编号级别id", required = true, dataType = "Long", paramType = "path")
    LevelNumberInfoVO detailCodeLevel(String type, Long id);

    /**
     * 设备编号级别上下移动
     *
     * @param upOrDown 向上或向下
     * @param id       主键id
     * @return {@link Boolean}
     */
    @PutMapping("move/{upOrDown}/{id}")
    @ApiOperation("上移/下移设备编号级别")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "upOrDown", value = "1:上移/-1:下移", required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "id", value = "设备编号级别id", required = true, dataType = "int", paramType = "path")
    })
    @ApiOperationSupport(order = 7)
    Boolean moveCodeLevel(String type, Integer upOrDown, Long id);

    /**
     * 保存设备编号规则
     *
     * @param ruleFormVO 设备规则表单VO
     * @return {@link Boolean}
     */
    @PostMapping("save/rule")
    @ApiOperation("新增设备编号规则")
    @ApiOperationSupport(order = 8)
    Boolean saveCodeRule(String type, RuleFormVO ruleFormVO);

    /**
     * 更新设备编号规则
     *
     * @param ruleFormVO 设备规则表单VO
     * @return {@link Boolean}
     */
    @PutMapping("update/rule")
    @ApiOperation("编辑设备编号规则")
    @ApiOperationSupport(order = 9)
    Boolean updateCodeRule(String type, RuleFormVO ruleFormVO);

    /**
     * 详细设备编号规则
     *
     * @param id 主键id
     * @return {@link RuleInfoVO}
     */
    @GetMapping("detail/rule/{id}")
    @ApiOperation("详情设备编号规则")
    @ApiOperationSupport(order = 10)
    @ApiImplicitParam(name = "id", value = "设备编号规则id", required = true, dataType = "Long", paramType = "path")
    RuleInfoVO detailCodeRule(String type, Long id);

    /**
     * 删除设备编号规则
     *
     * @param id 主键id
     * @return {@link Boolean}
     */
    @DeleteMapping("delete/rule/{id}")
    @ApiOperation("删除设备编号规则")
    @ApiOperationSupport(order = 11)
    @ApiImplicitParam(name = "id", value = "设备编号规则id", required = true, dataType = "Long", paramType = "path")
    Boolean deleteCodeRule(String type, Long id);

    /**
     * 列表规则编号
     *
     * @param levelId               级别标识
     * @param codeRuleDictQueryList 查询条件
     * @return {@link List}<{@link CodeRuleDictVO}>
     */
    @ApiOperation("获取指定级别设备编号规则")
    @PostMapping("/getRuleNumber")
    @ApiImplicitParam(name = "levelId", value = "设备编号级别id", required = true, paramType = "path", dataType = "Long")
    @ApiOperationSupport(order = 13)
    List<CodeRuleDictVO> listRuleDictSelect(String type, Long levelId, List<CodeRuleDictQueryVO> codeRuleDictQueryList);

    /**
     * 获取所有规则编号字典项
     *
     * @param levelId 级别标识
     * @return {@link List}<{@link CodeRuleDictVO}>
     */
    @ApiOperation("获取设备编号级别-前置条件添加")
    @GetMapping("/list-all-dict/{levelId}")
    List<CodeRuleDictVO> listAllDictByRuleLevel(String type, Long levelId);

    /**
     * 检查字典值
     *
     * @param type        类型
     * @param validDictVO 有效字典 VO
     * @return {@link ValidDictVO}
     */
    @ApiOperation("校验字典值")
    @PostMapping("/check-dict-value")
    ValidDictVO checkDictValue(String type, ValidDictVO validDictVO);

    /**
     * 按级别 ID 列出级别
     *
     * @param nowLevelId 现在级别 ID
     * @return {@link List}<{@link LevelNumberInfoVO}>
     */
    @ApiOperation("获取设备编号级别")
    @GetMapping("/list-level/{nowLevelId}")
    @ApiOperationSupport(order = 12)
    List<LevelNumberInfoVO> listLevelByLevelId(String type, Long nowLevelId);
}
